package com.guslegend.Class01_ioc.test;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author: guslegend
 * @description: Bean 属性赋值：引入外部Properties配置参数
 * @create: 2025-04-27 10:55
 **/
public class OutBean {

    @Test
    public void testOut() throws SQLException {
        ApplicationContext iocContainer=
                new ClassPathXmlApplicationContext("bean2.xml");
        DataSource dataSource=iocContainer.getBean(DataSource.class);
        Connection connection=dataSource.getConnection();
        System.out.println("connection="+connection);
    }
}
